package com.example.hellomap;

import android.test.ActivityInstrumentationTestCase2;

import com.example.hellomap.MainActivity;
import com.example.hellomap.MyGoogleMap;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;

public class Test_MyGoogleMap extends ActivityInstrumentationTestCase2<MainActivity> {

	MainActivity	myMain;	// kell egy activity a terkephez - ezt mockolni kellene!
	MyGoogleMap 	myMap;	// kell egy terkep amit tesztelunk
	
	public Test_MyGoogleMap() {
		super(MainActivity.class);
	}	
	
    @Override
    protected void setUp() throws Exception {

        super.setUp();
        myMain = getActivity();
        myMap = myMain.getMymap();
    }		
	
	public void test_MyGoogleMap_isGoogleMapCreated() {
		
		assertNotNull( myMap.getMyGoogleMap() );
	}

	public void test_MyGoogleMap_isMapSetToMapWhenNullIsProvided() {
		myMap.setUpMapIfNeeded(null);
		assertNotNull( myMap.getMyGoogleMap() );
	}
	
	public void test_MyGoogleMap_isMapSetToProvidedGoogleMap() {
		GoogleMap testMap = ((SupportMapFragment)(myMain.getSupportFragmentManager().findFragmentById(R.id.map_layout))).getMap();
		myMap.setUpMapIfNeeded(testMap);
		assertNotNull( myMap.getMyGoogleMap() );
	}	

}
